﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Infragistics.Win.UltraWinSchedule;
using Infragistics.Win.UltraWinSchedule.CalendarCombo;
using Infragistics.Win;

namespace Home.Haushalt.Gui
{
    public partial class HCalendarCombo : UserControl
    {
        /// <summary></summary>
        public DateButtonsCollection DateButtons { get { return CalendarCombo.DateButtons; } }

        /// <summary></summary>
        public int NonAutoSizeHeight { get { return CalendarCombo.NonAutoSizeHeight; } set { CalendarCombo.NonAutoSizeHeight=value; } }

        /// <summary></summary>
        public object Value { get { return CalendarCombo.Value; } set { CalendarCombo.Value = value; } }

        /// <summary></summary>
        public new ControlBindingsCollection DataBindings { get { return CalendarCombo.DataBindings; } }

        /// <summary>
        /// 
        /// </summary>
        public HCalendarCombo()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void HCalenderCombo1_Load(object sender, EventArgs e)
        {
            CalendarCombo.CalendarLook.ViewStyle = ViewStyle.Office2007;

            DateButton btn1=new DateButton();
            btn1.Caption = "-2";
            btn1.Type = DateButtonType.Custom;
            btn1.Date = DateTime.Now.AddDays(-2);
            CalendarCombo.DateButtons.Add(btn1);

            DateButton btn2 = new DateButton();
            btn2.Caption = "-1";
            btn2.Type = DateButtonType.Custom;
            btn2.Date = DateTime.Now.AddDays(-1);
            CalendarCombo.DateButtons.Add(btn2);

            DateButton btn3 = new DateButton();
            btn3.Caption = "+1";
            btn3.Type = DateButtonType.Custom;
            btn3.Date = DateTime.Now.AddDays(1);
            CalendarCombo.DateButtons.Add(btn3);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnToday_Click(object sender, EventArgs e)
        {
            CalendarCombo.Value = DateTime.Now;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnClear_Click(object sender, EventArgs e)
        {
            CalendarCombo.Value = null;
            CalendarCombo.Focus();
            CalendarCombo.SelectAll();
        }
    }
}
